
//初始值
export const initState = {
   //初始化数据
  //购物车列表
  cartlist:[],
  //购物车添加
  cartadd:[],
  //购物车删除
  cartdelete:[],
  //全选
//   allcheck:[]
  };
  
  //reducer 修改数据
  export const reducer = (state = initState, action) => {
    switch (action.type) {
      // 新人专享
      case 'changeCartlist':
        return {
          ...state,
          cartlist: action.cartlist,
        };
        case 'changeCartadd':
        return {
          ...state,
          cartadd: action.cartadd,
        };
        case 'changeCartdelete':
            return {
              ...state,
              cartdelete: action.cartdelete,
            };
      default:
        return state;
    }
  };
  //actionCreators组件派发的动作
  export const actions = {
    
    changeCartlist: (cartlist) => ({ type: 'changeCartlist', cartlist}),
    changeCartadd: (cartadd) => ({ type: 'changeCartadd', cartadd}),
    changeCartdelete: (cartdelete) => ({ type: 'changeCartdelete', cartdelete}),
  };
  
  
  